package com.ross.mode.store.impl;

import com.alibaba.fastjson.JSON;
import com.ross.entity.card.IQiYiCardService;
import com.ross.mode.store.ICommondity;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * @version 1.0.0
 * @className: CardCommodityService
 * @description: 第三方兑换卡
 * @author: zhangjunfa
 * @date: 2023/3/27 16:34
 */
@Slf4j
public class CardCommodityService implements ICommondity {
    // 模拟注入
    private IQiYiCardService iQiYiCardService=new IQiYiCardService();

    public void sendCommodity(String uId, String commodityId, String bizId, Map<String, String> extMap) throws Exception {
        String mobild=queryUserMobile(uId);
        iQiYiCardService.grantToken(mobild,bizId);
        log.info("请求参数[爱奇艺兑换卡] => uId：{} commodityId：{} bizId：{} extMap：{}", uId, commodityId, bizId, JSON.toJSON(extMap));
        log.info("测试结果[爱奇艺兑换卡]：success");
    }

    private String queryUserMobile(String uId){
        return "1546454784274";
    }
}
